package com.scsystem.xysc.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * 
 * @TableName action_log
 */
@TableName(value ="action_log")
@Data
public class ActionLog implements Serializable {
    /**
     * 唯一标识日志的ID
     */
    @TableId(value = "log_id", type = IdType.AUTO)
    private Long logId;

    /**
     * 日志的类型（info，warning，error等）
     */
    @TableField(value = "log_type")
    private String logType;

    /**
     * 执行操作的操作者的ID
     */
    @TableField(value = "action_id")
    private Long actionId;

    /**
     * 本次操作的用户类型（管理员\商家\用户）
     */
    @TableField(value = "user_type")
    private String userType;

    /**
     * 记录的时间
     */
    @TableField(value = "action_time")
    private LocalDateTime actionTime;

    /**
     * 请求的网址
     */
    @TableField(value = "url")
    private String url;

    /**
     * 本次操作的描述
     */
    @TableField(value = "operation_description")
    private String operationDescription;

    /**
     * 日志记录的信息（IP地址，url地址，报错详情）
     */
    @TableField(value = "message")
    private String message;

    /**
     * 传入的参数
     */
    @TableField(value = "parameter")
    private String parameter;

    /**
     * 返回结果
     */
    @TableField(value = "result")
    private String result;

    /**
     * IP地址
     */
    @TableField(value = "IPAddr")
    private String ipaddr;

    /**
     * 执行耗时
     */
    @TableField(value = "time_consuming")
    private Long timeConsuming;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ActionLog other = (ActionLog) that;
        return (this.getLogId() == null ? other.getLogId() == null : this.getLogId().equals(other.getLogId()))
            && (this.getLogType() == null ? other.getLogType() == null : this.getLogType().equals(other.getLogType()))
            && (this.getActionId() == null ? other.getActionId() == null : this.getActionId().equals(other.getActionId()))
            && (this.getUserType() == null ? other.getUserType() == null : this.getUserType().equals(other.getUserType()))
            && (this.getActionTime() == null ? other.getActionTime() == null : this.getActionTime().equals(other.getActionTime()))
            && (this.getUrl() == null ? other.getUrl() == null : this.getUrl().equals(other.getUrl()))
            && (this.getOperationDescription() == null ? other.getOperationDescription() == null : this.getOperationDescription().equals(other.getOperationDescription()))
            && (this.getMessage() == null ? other.getMessage() == null : this.getMessage().equals(other.getMessage()))
            && (this.getParameter() == null ? other.getParameter() == null : this.getParameter().equals(other.getParameter()))
            && (this.getResult() == null ? other.getResult() == null : this.getResult().equals(other.getResult()))
            && (this.getIpaddr() == null ? other.getIpaddr() == null : this.getIpaddr().equals(other.getIpaddr()))
            && (this.getTimeConsuming() == null ? other.getTimeConsuming() == null : this.getTimeConsuming().equals(other.getTimeConsuming()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getLogId() == null) ? 0 : getLogId().hashCode());
        result = prime * result + ((getLogType() == null) ? 0 : getLogType().hashCode());
        result = prime * result + ((getActionId() == null) ? 0 : getActionId().hashCode());
        result = prime * result + ((getUserType() == null) ? 0 : getUserType().hashCode());
        result = prime * result + ((getActionTime() == null) ? 0 : getActionTime().hashCode());
        result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode());
        result = prime * result + ((getOperationDescription() == null) ? 0 : getOperationDescription().hashCode());
        result = prime * result + ((getMessage() == null) ? 0 : getMessage().hashCode());
        result = prime * result + ((getParameter() == null) ? 0 : getParameter().hashCode());
        result = prime * result + ((getResult() == null) ? 0 : getResult().hashCode());
        result = prime * result + ((getIpaddr() == null) ? 0 : getIpaddr().hashCode());
        result = prime * result + ((getTimeConsuming() == null) ? 0 : getTimeConsuming().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", logId=").append(logId);
        sb.append(", logType=").append(logType);
        sb.append(", actionId=").append(actionId);
        sb.append(", userType=").append(userType);
        sb.append(", actionTime=").append(actionTime);
        sb.append(", url=").append(url);
        sb.append(", operationDescription=").append(operationDescription);
        sb.append(", message=").append(message);
        sb.append(", parameter=").append(parameter);
        sb.append(", result=").append(result);
        sb.append(", ipaddr=").append(ipaddr);
        sb.append(", timeConsuming=").append(timeConsuming);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}